package com.bootdo.system.controller;

import com.bootdo.system.domain.ContentDO;
import com.bootdo.system.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.HashMap;
import java.util.List;

@Controller
public class ZixunConreoller {

    @Autowired
    private ContentService contentService;

    @GetMapping("/zixun")
    public String zixunPage(Model model) {

        List<ContentDO> contentDOS = contentService.list(new HashMap<>());
        model.addAttribute("contentDOS", contentDOS);


        model.addAttribute("active", "4");
        return "zixun";
    }

    @GetMapping("/blogContent")
    public String blogContentPage(Long cid, Model model) {

         ContentDO contentDO = contentService.get(cid);

         model.addAttribute("contentDO",contentDO);

        return "blogContent";
    }
}
